/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gestion;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Juan Antonio Tirado
 */
@Entity
@Table(name = "albaran", catalog = "lpd", schema = "")
@NamedQueries({@NamedQuery(name = "Albaran.findAll", query = "SELECT a FROM Albaran a"), @NamedQuery(name = "Albaran.findByIDalbaran", query = "SELECT a FROM Albaran a WHERE a.iDalbaran = :iDalbaran"), @NamedQuery(name = "Albaran.findByFecha", query = "SELECT a FROM Albaran a WHERE a.fecha = :fecha"), @NamedQuery(name = "Albaran.findByIDtrabajo", query = "SELECT a FROM Albaran a WHERE a.iDtrabajo = :iDtrabajo"), @NamedQuery(name = "Albaran.findByTotal", query = "SELECT a FROM Albaran a WHERE a.total = :total")})
public class Albaran implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_albaran")
    private Integer iDalbaran;
    @Column(name = "Fecha")
    private String fecha;
    @Column(name = "ID_trabajo")
    private Integer iDtrabajo;
    @Column(name = "Total")
    private Float total;

    public Albaran() {
    }

    public Albaran(Integer iDalbaran) {
        this.iDalbaran = iDalbaran;
    }

    public Albaran(Integer iDalbaran, String fecha, Integer iDtrabajo, float total) {
        this.iDalbaran=iDalbaran;
        this.fecha=fecha;
        this.iDtrabajo=iDtrabajo;
        this.total=total;
    }

    public Integer getIDalbaran() {
        return iDalbaran;
    }

    public void setIDalbaran(Integer iDalbaran) {
        Integer oldIDalbaran = this.iDalbaran;
        this.iDalbaran = iDalbaran;
        changeSupport.firePropertyChange("IDalbaran", oldIDalbaran, iDalbaran);
    }

    public String getFecha() {
        return fecha;
    }

    public void setFecha(String fecha) {
        String oldFecha = this.fecha;
        this.fecha = fecha;
        changeSupport.firePropertyChange("fecha", oldFecha, fecha);
    }

    public Integer getIDtrabajo() {
        return iDtrabajo;
    }

    public void setIDtrabajo(Integer iDtrabajo) {
        Integer oldIDtrabajo = this.iDtrabajo;
        this.iDtrabajo = iDtrabajo;
        changeSupport.firePropertyChange("IDtrabajo", oldIDtrabajo, iDtrabajo);
    }

    public Float getTotal() {
        return total;
    }

    public void setTotal(Float total) {
        Float oldTotal = this.total;
        this.total = total;
        changeSupport.firePropertyChange("total", oldTotal, total);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iDalbaran != null ? iDalbaran.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Albaran)) {
            return false;
        }
        Albaran other = (Albaran) object;
        if ((this.iDalbaran == null && other.iDalbaran != null) || (this.iDalbaran != null && !this.iDalbaran.equals(other.iDalbaran))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "alertas.Albaran[iDalbaran=" + iDalbaran + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
